package com.tjp.eight.utils;

import java.util.Random;

/**
 * Created by Administrator on 2017/3/21.
 */

public class Cutils {
    private static Cutils bmpCode;
    private Random random = new Random();
    private static final char[] CHARS = {'0', '1',
            '2', '3', '4', '5', '6', '7', '8', '9'
    };
    public static Cutils getInstance() {
        if (bmpCode == null)
            bmpCode = new Cutils();
        return bmpCode;
    }
    private String createCode() {
        StringBuilder buffer = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            buffer.append(CHARS[random.nextInt(CHARS.length)]);
        }
        return buffer.toString();
    }
    public String getCode() {
        return createCode();
    }

}
